# -*- coding: utf-8 -*-
import random
import pygame
from Setting import *

class Food(object):

    def __init__(self, game):
        self.game = game
        self.set_pos()

    def set_pos(self):
        all_pos = [(x, y) for x in range(0, COL) for y in range(0, ROW)]
        left_pos = list(set(all_pos) - set(self.game.snake.body))
        self.pos = random.choice(left_pos)

    def draw(self):
        pos = (self.pos[0] * CELL + CELL / 2, self.pos[1] * CELL + CELL / 2)
        pygame.draw.circle(self.game.game_zone, (255, 0, 0), pos, CELL / 3)
